package utility;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTool {
private static SimpleDateFormat date_format;
public static void setDateFormat(String format){
	date_format=new SimpleDateFormat(format);
}
public static java.sql.Date getDateSQL(String date){
	java.util.Date x=new  Date();
	setDateFormat("yyyy/MM/dd");
	try {
		x=date_format.parse(date);
		return new java.sql.Date(x.getTime());
	} catch (ParseException e) {
		e.printStackTrace();
	}
	return null;
}
public static java.sql.Date getDateSQL(String date,String format){
	java.util.Date x=new  Date();
	setDateFormat(format);
	try {
		x=date_format.parse(date);
		return new java.sql.Date(x.getTime());
	} catch (ParseException e) {
		e.printStackTrace();
	}
	return null;
}
}
